home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / ietf / urn / urn-archives / urn-ietf.archive.9701 / 000004_owner-urn-ietf _Thu Jan 9 12:53:02 1997.msg < prev    next >
Internet Message Format  |  1997-02-19  |  44KB

  1. Received: (from daemon@localhost) by services.bunyip.com (8.6.10/8.6.9) id MAA23896 for urn-ietf-out; Thu, 9 Jan 1997 12:53:02 -0500
  2. Received: from mocha.bunyip.com (mocha.Bunyip.Com [192.197.208.1]) by services.bunyip.com (8.6.10/8.6.9) with SMTP id MAA23887 for <urn-ietf@services.bunyip.com>; Thu, 9 Jan 1997 12:52:53 -0500
  3. Received: from acl.lanl.gov by mocha.bunyip.com with SMTP (5.65a/IDA-1.4.2b/CC-Guru-2b)
  4.         id AA03819  (mail destined for urn-ietf@services.bunyip.com); Thu, 9 Jan 97 12:52:20 -0500
  5. Received: from magenta.acl.lanl.gov (magenta.acl.lanl.gov [128.165.147.153]) by acl.lanl.gov (8.7.3/8.7.3) with ESMTP id KAA01066 for <urn-ietf@bunyip.com>; Thu, 9 Jan 1997 10:52:13 -0700 (MST)
  6. From: "Ronald E. Daniel" <rdaniel@acl.lanl.gov>
  7. Received: (rdaniel@localhost) by magenta.acl.lanl.gov (8.7.5/8.6.4) id KAA01261 for urn-ietf@bunyip.com; Thu, 9 Jan 1997 10:52:13 -0700 (MST)
  8. Date: Thu, 9 Jan 1997 10:52:13 -0700 (MST)
  9. Message-Id: <199701091752.KAA01261@magenta.acl.lanl.gov>
  10. To: urn-ietf@bunyip.com
  11. Subject: [URN] next version of NAPTR
  12. Sender: owner-urn-ietf@services.bunyip.com
  13. Precedence: bulk
  14. Reply-To: "Ronald E. Daniel" <rdaniel@acl.lanl.gov>
  15. Errors-To: owner-urn-ietf@bunyip.com
  16.  
  17. Hi all,
  18.  
  19. Hope you had a happy holiday season. Now that I'm back at work,
  20. I've edited the NAPTR and HTTP conventions drafts. The NAPTR draft
  21. is appended, I'll send the HTTP conventions draft in a seperate
  22. message. The new versions are also available from:
  23.   http://www.acl.lanl.gov/URN/naptr.txt
  24.   http://www.acl.lanl.gov/URN/http_res.txt
  25.  
  26. Old versions are available from
  27.   http://www.acl.lanl.gov/URN/naptr-03.txt
  28.   http://www.acl.lanl.gov/URN/http_res-00.txt
  29. in case you care.
  30.  
  31. Some of the references need to be cleaned up - both drafts refer to
  32. the URN Resolution Services draft we decided needed to be written.
  33. Also, the NAPTR draft has a couple of other citations I have some
  34. questions about. Other than that I think these are complete. Your
  35. comments please!
  36.  
  37. Regards,
  38. Ron
  39. ===================
  40.  
  41.  
  42. INTERNET DRAFT                                                  Ron Daniel
  43. draft-ietf-urn-naptr-02.txt                 Los Alamos National Laboratory
  44.                                                           Michael Mealling
  45.                                                    Network Solutions, Inc.
  46.                                                              08 Jan., 1996
  47.  
  48.  
  49.                 Resolution of Uniform Resource Identifiers
  50.                        using the Domain Name System
  51.  
  52.  
  53. Status of this Memo
  54. ===================
  55.  
  56.     This document is an Internet-Draft.  Internet-Drafts are working
  57.     documents of the Internet Engineering Task Force (IETF), its
  58.     areas, and its working groups.  Note that other groups may also
  59.     distribute working documents as Internet-Drafts.
  60.   
  61.     Internet-Drafts are draft documents valid for a maximum of six
  62.     months and may be updated, replaced, or obsoleted by other
  63.     documents at any time.  It is inappropriate to use Internet-
  64.     Drafts as reference material or to cite them other than as
  65.     ``work in progress.''
  66.   
  67.     To learn the current status of any Internet-Draft, please check
  68.     the ``1id-abstracts.txt'' listing contained in the Internet-
  69.     Drafts Shadow Directories on ftp.is.co.za (Africa),
  70.     nic.nordu.net (Europe), munnari.oz.au (Pacific Rim),
  71.     ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast).
  72.  
  73.     This draft expires 14 July, 1997.
  74.   
  75.   
  76. Abstract:
  77. =========
  78.  
  79. Uniform Resource Locators (URLs) are the foundation of the World Wide
  80. Web, and are a vital Internet technology. However, they have proven to
  81. be brittle in practice. The basic problem is that URLs typically
  82. identify a particular path to a file on a particular host. There is no
  83. graceful way of changing the path or host once the URL has been
  84. assigned. Neither is there a graceful way of replicating the resource
  85. located by the URL to achieve better network utilization and/or fault
  86. tolerance. Uniform Resource Names (URNs) have been hypothesized as a
  87. adjunct to URLs that would overcome such problems. URNs and URLs
  88. are both instances of a broader class of identifiers known as Uniform
  89. Resource Identifiers (URIs).
  90.  
  91. This document describes a new DNS Resource Record, NAPTR (Naming
  92. Authority PoinTeR), that provides rules for mapping parts of URIs to
  93. domain names.  By changing the mapping rules, we can change the host
  94. that is contacted to resolve a URI. This will allow a more graceful
  95. handling of URLs over long time periods, and forms the foundation for a
  96. new proposal for Uniform Resource Names.
  97.  
  98. In addition to locating resolvers, the NAPTR provides for other naming
  99. systems to be grandfathered into the URN world, provides independence
  100. between the name assignment system and the resolution protocol system,
  101. and allows multiple services (Name to Location, Name to Description,
  102. Name to Resource, ...) to be offered.  In conjunction with the SRV RR,
  103. the NAPTR record allows those services to be replicated for the purposes
  104. of fault tolerance and load balancing.
  105.  
  106.  
  107. Introduction:
  108. =============
  109.  
  110. Uniform Resource Locators have been a significant advance in locating
  111. resources on the Internet. However, their  brittle nature over time
  112. has been recognized for several years. The Uniform Resource Identifier
  113. working group proposed the development of Uniform Resource Names to serve
  114. as persistent, location-independent identifiers for Internet resources
  115. in order to overcome most of the problems with URLs. RFC-1737 [1] sets
  116. forth requirements on URNs.
  117.  
  118. During the lifetime of the URI-WG, a number of URN proposals were
  119. generated. The developers of several of those proposals met in a series
  120. of meetings, resulting in a compromise known as the Knoxville framework.
  121. The major principle behind the Knoxville framework is that the resolution
  122. system must be separate from the way names are assigned. This is in
  123. marked contrast to most URLs, which identify the host to contact and
  124. the protocol to use. Readers are referred to [2] for background on the
  125. Knoxville framework and for additional information on the context and
  126. purpose of this proposal.
  127.  
  128. Separating the way names are resolved from the way they are constructed
  129. provides several benefits. It allows multiple naming approaches and
  130. resolution approaches to compete, as it allows different protocols and
  131. resolvers to be used. There is just one problem with such a separation -
  132. how do we resolve a name when it can't give us directions to its
  133. resolver?
  134.  
  135. For the short term, DNS is the obvious candidate for the resolution
  136. framework, since it is widely deployed and understood. However, it is
  137. not appropriate to use DNS to maintain information on a per-resource
  138. basis. First of all, DNS was never intended to handle that many
  139. records. Second, the limited record size is inappropriate for catalog
  140. information. Third, domain names are not appropriate as URNs.
  141.  
  142. Therefore our approach is to use DNS to locate "resolvers" that can
  143. provide information on individual resources, potentially including the
  144. resource itself. To accomplish this, we "rewrite" the URI into a domain
  145. name following the rules provided in NAPTR records. Rewrite rules
  146. provide considerable power, which is important when trying to meet the
  147. goals listed above. However, collections of rules can become difficult
  148. to understand. To lessen this problem, the NAPTR rules are *always*
  149. applied to the original URI, *never* to the output of previous rules.
  150.  
  151. Locating a resolver through the rewrite procedure may take multiple
  152. steps, but the beginning is always the same. Every URI has a
  153. colon-delimited prefix.  NAPTR resolution begins by taking this prefix,
  154. appending the well-known suffix ".urn.net", and querying the DNS for NAPTR
  155. records at that domain name.  Based on the results of this query, zero
  156. or more additional DNS queries may be needed to locate resolvers for the
  157. URI. The details of the conversation between the client and the resolver
  158. thus located are outside the bounds of this draft. Three brief examples of
  159. this procedure are given in the next section.
  160.  
  161. The NAPTR RR provides the level of indirection needed to keep the naming
  162. system independent of the resolution system, its protocols, and services.
  163. Coupled with the new SRV resource record proposal[3] there is also the
  164. potential for replicating the resolver on multiple hosts, overcoming some
  165. of the most significant problems of URLs. This is an important and subtle
  166. point. Not only do the NAPTR and SRV records allow us to replicate
  167. the resource, we can replicate the resolvers that know about the replicated
  168. resource. Preventing a single point of failure at the resolver level
  169. is a significant benefit. Separating the resolution procedure from the
  170. way names are constructed has additional benefits. Different resolution
  171. procedures can be used over time, and resolution procedures that are
  172. determined to be useful can be extended to deal with additional namespaces.
  173.  
  174. Caveats
  175. =======
  176.  
  177. The NAPTR proposal is the first resolution procedure to be considered by the
  178. URN-WG. There are several concerns about the proposal which have motivated
  179. the group to recommend it for publication as an Experimental rather than a
  180. standards-track RFC.
  181.  
  182. First, URN resolution is new to the IETF and we wish to gain operational
  183. experience before recommending any procedure for the standards track. Second,
  184. the NAPTR proposal is based on DNS and consequently inherits concerns about
  185. security and administration. The recent advancement of the DNSSEC and secure
  186. update drafts to Proposed Standard reduce these concerns, but we wish to
  187. experiment with those new capabilities in the context of URN administration.
  188. A third area of concern is the potential for a noticeable impact on the DNS.
  189. We believe that the proposal makes appropriate use of caching and additional
  190. information, but it is best to go slow where the potential for impact on a
  191. core system like the DNS is concerned. Fourth, the rewrite rules in the NAPTR
  192. proposal are based on regular expressions. Since regular expressions are
  193. difficult for humans to construct correctly, concerns exist about the
  194. usability and maintainability of the rules. This is especially true where
  195. international character sets are concerned.
  196.  
  197. Terminology
  198. ===========
  199.  
  200. "Must" or "Shall" - Software that does not behave in the manner that this
  201.            document says it must is not conformant to this document.
  202. "Should" - Software that does not follow the behavior that this document
  203.            says it should may still be conformant, but is probably broken
  204.            in some fundamental way.
  205. "May" -    Implementations may or may not provide the described behavior,
  206.            while still remaining conformant to this document.
  207.  
  208.  
  209. Brief overview and examples of the NAPTR RR:
  210. ============================================
  211.  
  212. A detailed description of the NAPTR RR will be given later, but to give
  213. a flavor for the proposal we first give a simple description of the
  214. record and three examples of its use.
  215.  
  216. The key fields in the NAPTR RR are order, preference, service, flags,
  217. regexp, and replacement:
  218. * The order field specifies the order in which records MUST be processed
  219.   when multiple NAPTR records are returned in response to a single query.
  220.   A naming authority may have delegated a portion of its namespace to
  221.   another agency. Evaluating the NAPTR records in the correct order is
  222.   necessary for delegation to work properly.
  223. * The preference field specifies the order in which records SHOULD
  224.   be processed when multiple NAPTR records have the same value of "order".
  225.   This field lets a service provider specify the order in which resolvers
  226.   are contacted, so that more capable machines are contacted in preference
  227.   to less capable ones.
  228. * The service field specifies the resolution protocol and resolution
  229.   service(s) that will be available if the rewrite specified by the
  230.   regexp or replacement fields is applied. Resolution protocols are
  231.   the protocols used to talk with a resolver. They will be specified in
  232.   other documents, such as [4]. Resolution services are operations such as
  233.   N2R (URN to Resource), N2L (URN to URL), N2C (URN to URC), etc.
  234.   These will be discussed in the URN Resolution Services document[5], and
  235.   their behavior in a particular resolution protocol will be given in
  236.   the specification for that protocol (see [4] for a concrete example).
  237. * The flags field contains modifiers that affect what happens in the
  238.   next DNS lookup, typically for optimizing the process. Flags may also
  239.   affect the interpretation of the other fields in the record, therefore,
  240.   clients MUST skip NAPTR records which contain an unknown flag value.
  241. * The regexp field is one of two fields used for the rewrite rules, and is
  242.   the core concept of the NAPTR record. The regexp field is a String
  243.   containing a sed-like substitution expression. (The actual grammar for
  244.   the substitution expressions is given later in this draft). The
  245.   substitution expression is applied to the original URN to determine the
  246.   next domain name to be queried. The regexp field should be used when the
  247.   domain name to be generated is conditional on information in the URI. If
  248.   the next domain name is always known, which is anticipated to be a common
  249.   occurrence, the replacement field should be used instead.
  250. * The replacement field is the other field that may be used for the rewrite
  251.   rule. It is an optimization of the rewrite process for the case where the
  252.   next domain name is fixed instead of being conditional on the content of
  253.   the URI. The replacement field is a domain name (subject to compression if
  254.   a DNS sender knows that a given recipient is able to decompress names in
  255.   this RR type's RDATA field). If the rewrite is more complex than a simple
  256.   substitution of a domain name, the replacement field should be set to . and
  257.   the regexp field used. 
  258.  
  259. Note that the client applies all the substitutions and performs all lookups,
  260. they are not performed in the DNS servers. Note also that it is the belief
  261. of the developers of this document that regexps should rarely be used. The
  262. replacement field seems adequate for the vast majority of situations. Regexps
  263. are only necessary when portions of a namespace are to be delegated to
  264. different resolvers. Finally, note that the regexp and replacement fields are,
  265. at present, mutually exclusive. However, developers of client software should 
  266. be aware that a new flag might be defined which requires values in both fields.
  267.  
  268.  
  269. Example 1
  270. ---------
  271.  
  272. Consider a URN that uses the hypothetical DUNS namespace. DUNS numbers are
  273. identifiers for approximately 30 million registered businesses around
  274. the world, assigned and maintained by Dunn and Bradstreet. The URN
  275. might look like:
  276.  
  277.                  urn:duns:002372413:annual-report-1997
  278.  
  279. The first step in the resolution process is to find out about the DUNS
  280. namespace. The namespace identifier, duns, is extracted from the URN,
  281. prepended to urn.net, and the NAPTRs for duns.urn.net looked up. It might
  282. return records of the form:
  283.  
  284. duns.urn.net
  285. ;;      order pref flags service          regexp        replacement
  286.  IN NAPTR 100  10  "s"  "dunslink+N2L+N2C"  ""   dunslink.udp.isi.dandb.com
  287.  IN NAPTR 100  20  "s"  "rcds+N2C"          ""   rcds.udp.isi.dandb.com
  288.  IN NAPTR 100  30  "s"  "http+N2L+N2C+N2R"  ""   http.tcp.isi.dandb.com
  289.  
  290. The order field contains equal values, indicating that no name delegation
  291. order has to be followed. The preference field indicates that the provider
  292. would like clients to use the special dunslink protocol, followed by
  293. the RCDS protocol, and that HTTP is offered as a last resort. All the
  294. records specify the "s" flag, which will be explained momentarily.
  295. The service fields say that if we speak dunslink, we will be able to
  296. issue either the N2L or N2C requests to obtain a URL or a URC (description)
  297. of the resource. The Resource Cataloging and Distribution Service (RCDS)[6]
  298. could be used to get a URC for the resource, while HTTP could be used to get
  299. a URL, URC, or the resource itself.  All the records supply the next
  300. domain name to query, none of them need to be rewritten with the aid of
  301. regular expressions.
  302.  
  303. The general case might require multiple NAPTR rewrites to locate a
  304. resolver, but eventually we will come to the "terminal NAPTR". Once we
  305. have the terminal NAPTR, our next probe into the DNS will be for a SRV 
  306. or A record instead of another NAPTR. Rather than probing for a non-existent
  307. NAPTR record to terminate the loop, the flags field is used to indicate
  308. a terminal lookup. If it has a value of "s", the next lookup should
  309. be for SRV RRs, "a" denotes that A records should sought. A "p" flag is
  310. also provided to indicate that the next action is Protocol-specific, but
  311. that looking up another NAPTR will not be part of it.
  312.  
  313. Since our example RR specified the "s" flag, it was terminal. Assuming our
  314. client does not know the dunslink protocol, our next action is to lookup SRV
  315. RRs for rcds.udp.isi.dandb.com, which will tell us hosts that can provide
  316. the necessary resolution service. That lookup might return:
  317.  
  318.  ;;                          Pref Weight Port Target
  319.  rcds.udp.isi.dandb.com IN SRV 0    0    1000 defduns.isi.dandb.com
  320.                         IN SRV 0    0    1000 dbmirror.com.au
  321.                         IN SRV 0    0    1000 ukmirror.com.uk
  322.  
  323. telling us three hosts that could actually do the resolution, and
  324. giving us the port we should use to talk to their RCDS server.
  325. (The reader is referred to the SRV proposal [3] for the interpretation
  326. of the fields above).
  327.  
  328. There is opportunity for significant optimization here. We can return the SRV
  329. records as additional information for terminal NAPTRs (and the A records as
  330. additional information for those SRVs). While this recursive provision of
  331. additional information is not explicitly blessed in the DNS specifications, it
  332. is not forbidden, and BIND does take advantage of it [7]. This is a significant
  333. optimization. In conjunction with a long TTL for *.urn.net records, the average
  334. number of probes to DNS for resolving DUNS URNs would approach one. Therefore,
  335. DNS server implementors SHOULD provide additional information with NAPTR
  336. responses. The additional information will be either SRV or A records. If SRV
  337. records are available, their A records should be provided as recursive
  338. additional information.
  339.  
  340. Note that the example NAPTR records above are intended to represent the
  341. reply the client will see. They are not quite identical to what the
  342. domain administrator would put into the zone files. For one thing, the
  343. administrator should supply the trailing '.' character on replacement
  344. domain names. An additional difference will be illustrated later.
  345.  
  346.  
  347. Example 2 
  348. ---------
  349.  
  350. Consider a URN namespace based on MIME Content-Ids. The URN might look
  351. like this:
  352.   
  353.         urn:cid:199606121851.1@mordred.gatech.edu
  354.   
  355. The first step in the resolution process is to find out about the CID
  356. namespace. The namespace identifier, cid, is extracted from the URN,
  357. prepended to urn.net, and the NAPTR for cid.urn.net looked up. It might
  358. return records of the form:
  359.  
  360.  cid.urn.net
  361.   ;;       order pref flags service        regexp           replacement
  362.    IN NAPTR 100   10   ""     ""  "/urn:cid:.+@([^@]+)$/\1/i"    .
  363.  
  364. We have only one NAPTR response, so ordering the responses is not
  365. a problem.  The replacement field is empty, so we check the regexp
  366. field and use the pattern provided there. We apply that regexp to the
  367. entire URN to see if it matches, which it does.  The \1 part of the
  368. substitution expression returns the string "mordred.gatech.edu". Since
  369. the flags field does not contain "s" or "a", the lookup is not terminal
  370. and our next probe to DNS is for more NAPTR records: lookup(query=NAPTR,
  371. "mordred.gatech.edu").
  372.  
  373. While mordred could have its very own NAPTR, maintaining those records
  374. on all the machines at a site as large as Georgia Tech would be an
  375. intolerable burden. Instead, a wildcard may be used so that the domain
  376. administrator at Georgia Tech has only a single NAPTR record to
  377. maintain. That record might look like:
  378.  
  379. *.gatech.edu IN NAPTR
  380. ;;       order pref flags service           regexp  replacement
  381.   IN NAPTR 100  50  "s"  "z3950+N2L+N2C"     ""    z3950.tcp.gatech.edu.
  382.   IN NAPTR 100  50  "s"  "rcds+N2C"          ""    rcds.udp.gatech.edu.
  383.   IN NAPTR 100  50  "s"  "http+N2L+N2C+N2R"  ""    http.tcp.gatech.edu.
  384.  
  385. (Unlike all the other example records in this draft, the one above
  386. is the contents of a zone file, not the response received by the
  387. client. That is so that the wildcard can be seen.)
  388.  
  389. Continuing with our example, we note that the values of the order and
  390. preference fields are equal in all records, so the client is free to
  391. pick any record. The flags field tells us that these are the last NAPTR
  392. patterns we should see, and after the rewrite (a simple replacement in
  393. this case) we should look up SRV records to get information on the
  394. hosts that can provide the necessary service.
  395.  
  396. Assuming we prefer the Z39.50 protocol, our lookup might return:
  397.  
  398. ;;                        Pref Weight   Port Target
  399. z3950.tcp.gatech.edu IN SRV 0    0      1000 z3950.gatech.edu
  400.                      IN SRV 0    0      1000 z3950.cc.gatech.edu
  401.                      IN SRV 0    0      1000 z3950.uga.edu
  402.  
  403. telling us three hosts that could actually do the resolution, and
  404. giving us the port we should use to talk to their Z39.50 server.
  405.  
  406. Recall that the regular expression used \1 to extract a domain name
  407. from the CID. There is a significant caveat about the use of
  408. backslashes in DNS zone files. DNS treats backslashes as the escape
  409. character so that '.' can be escaped when necessary. This means that
  410. when a regular expression is entered into the zone file, the
  411. backslashes must be escaped by another backslash.  For the case of the
  412. cid.urn.net record above, the regular expression entered into the zone
  413. file should be "/.+@([^@]+)/\\1/i".  When the client code actually
  414. receives the record, the pattern will have been converted to
  415. "/.+@([^@]+)/\1/i".
  416.  
  417.  
  418. Example 3
  419. ---------
  420.  
  421. Even if URN systems were in place now, there would still be a
  422. tremendous number of URLs.  It should be possible to develop a URN
  423. resolution system that can also provide location independence for those
  424. URLs.  This is related to the requirement in [1] to be able to
  425. grandfather in names from other naming systems, such as ISO Formal
  426. Public Identifiers, Library of Congress Call Numbers, ISBNs, ISSNs,
  427. etc.
  428.  
  429. The NAPTR RR could also be used for URLs that have already been assigned.
  430. Assume we have the URL for a very popular piece of software that the
  431. publisher wishes to mirror at multiple sites around the world:
  432.  
  433.      http://www.foo.com/software/latest-beta.exe
  434.  
  435. We extract the prefix, "http", and lookup NAPTR records for
  436. http.urn.net. This might return a record of the form
  437.  
  438. http.urn.net IN NAPTR
  439. ;;  order   pref flags service      regexp             replacement
  440.      100     90   ""      ""   "!http://([^/:]+)!\1!i"       .
  441.  
  442.  
  443. This expression returns everything after the first double slash and
  444. before the next slash or colon. (We use the '!' character to delimit the
  445. parts of the substitution expression. Otherwise we would have to use backslashes to escape the forward slashes, and would have a regexp in the zone file that
  446. looked like "/http:\\/\\/([^\\/:]+)/\\1/i".).
  447.  
  448. Applying this pattern to the URL extracts "www.foo.com". Looking up NAPTR
  449. records for that might return:
  450.  
  451. www.foo.com
  452. ;;       order pref flags   service  regexp     replacement
  453.  IN NAPTR 100  100  "s"   "http+L2R"   ""    http.tcp.foo.com
  454.  IN NAPTR 100  100  "s"   "ftp+L2R"    ""    ftp.tcp.foo.com
  455.  
  456. Looking up SRV records for http.tcp.foo.com would return information
  457. on the hosts that foo.com has designated to be its mirror sites. The
  458. client can then pick one for the user. 
  459.  
  460.  
  461. NAPTR RR Format
  462. ===============
  463.  
  464. The format of the NAPTR RR is given below. The DNS type code for
  465. NAPTR is 104 [this is being changed, we believe it will be assigned 35].
  466.  
  467.     Domain TTL Class Order Preference Flags Service Regexp Replacement 
  468.  
  469. where:
  470.  
  471. Domain
  472.        The domain name this resource record refers to.
  473. TTL
  474.        Standard DNS Time To Live field
  475. Class
  476.        Standard DNS meaning
  477. Order
  478.        A 16-bit integer specifying the order in which the NAPTR records
  479.        MUST be processed to ensure correct delegation of portions
  480.        of the namespace over time. Low numbers are processed before
  481.        high numbers, and once a NAPTR is found that "matches" a URN,
  482.        the client MUST NOT consider any NAPTRs with a higher value
  483.        for order.
  484.  
  485. Preference
  486.        A 16-bit integer which specifies the order in which NAPTR records
  487.        with equal "order" values SHOULD be processed, low numbers
  488.        being processed before high numbers.  This is similar to the
  489.        preference field in an MX record, and is used so domain
  490.        administrators can direct clients towards more capable hosts
  491.        or lighter weight protocols. 
  492.  
  493. Flags
  494.        A String giving flags to control aspects of the rewriting and
  495.        interpretation of the fields in the record. Flags are single
  496.        characters from the set [A-Z0-9]. The case of the alphabetic
  497.        characters is not significant.
  498.  
  499.        At this time only three flags, "S", "A", and "P", are defined. "S"
  500.        means that the next lookup should be for SRV records instead of NAPTR
  501.        records. "A" means that the next lookup should be for A records. The
  502.        "P" flag says that the remainder of the resolution shall be carried
  503.        out in a Protocol-specific fashion, and we should not do any more
  504.        DNS queries.
  505.        
  506.        The remaining alphabetic flags are reserved. The numeric flags may be
  507.        used for local experimentation. The S, A, and P flags are all mutually
  508.        exclusive, and resolution libraries MAY signal an error if more
  509.        than one is given. (Experimental code and code for assisting in the
  510.        creation of NAPTRs would be more likely to signal such an error than
  511.        a client such as a browser). We anticipate that multiple flags will
  512.        be allowed in the future, so implementers MUST NOT assume that the
  513.        flags field can only contain 0 or 1 characters. Finally, if a client
  514.        encounters a record with an unknown flag, it MUST ignore it and move
  515.        to the next record. This test takes precedence even over the "order"
  516.        field. Since flags can control the interpretation placed on fields,
  517.        a novel flag might change the interpretation of the regexp and/or
  518.        replacement fields such that it is impossible to determine if a
  519.        record matched a URN.
  520.  
  521. Service 
  522.        Specifies the resolution service(s) available down this rewrite
  523.        path. It may also specify the particular protocol that is used to
  524.        talk with a resolver. A protocol MUST be specified if the flags field
  525.        states that the NAPTR is terminal. If a protocol is specified, but
  526.        the flags field does not state that the NAPTR is terminal, the next
  527.        lookup MUST be for a NAPTR. The client MAY choose not to perform
  528.        the next lookup if the protocol is unknown, but that behavior MUST NOT
  529.        be relied upon.
  530.     
  531.        The service field may take any of the values below (using the
  532.        Augmented BNF of RFC 822[8]):
  533.  
  534.            service_field = [ [protocol] *("+" rs)]
  535.            protocol      = "rcds" / "http" / "hdl" / "rwhois"
  536.            rs            = "N2L" / "N2Ls" / "N2R" / "N2Rs" / "N2C"
  537.                          / "N2Ns" / "L2R" / "L2Ns" / "L2Ls" / "L2C"
  538.  
  539.        i.e. an optional protocol specification followed by 0 or more
  540.        resolution services. Each resolution service is indicated by
  541.        an initial '+' character.
  542.  
  543.        Note that the empty string is also a valid service field. This
  544.        will typically be seen at the top levels of a namespace, when it
  545.        is impossible to know what services and protocols will be offered
  546.        by a particular publisher within that name space.
  547.  
  548.        At this time the known protocols are rcds[6], hdl[9] (binary,
  549.        UDP-based protocols),  http[4] (a textual, TCP-based protocol), and
  550.        rwhois[10] (textual, UDP or TCP based). More will be allowed later.
  551.        The names of the protocols must be formed from the characters [a-Z0-9].
  552.        Case of the characters is not significant.
  553.  
  554.        The service requests currently allowed will be described in more
  555.        detail in [5], but in brief they are:
  556.              N2L  - Given a URN, return a URL
  557.              N2Ls - Given a URN, return a set of URLs
  558.              N2R  - Given a URN, return an instance of the resource.
  559.              N2Rs - Given a URN, return multiple instances of the resouce,
  560.                     typically encoded using multipart/alternative.
  561.              N2C  - Given a URN, return a collection of meta-information on
  562.                     the named resource. The format of this response is the
  563.                     subject of another document.
  564.              N2Ns - Given a URN, return all URNs that are also identifers
  565.                     for the resource.
  566.              L2R  - Given a URL, return the resource.
  567.              L2Ns - Given a URL, return all the URNs that are identifiers for
  568.                     the resource.
  569.              L2Ls - Given a URL, return all the URLs for instances of
  570.                     of the same resource.
  571.              L2C  - Given a URL, return a description of the resource.
  572.  
  573.        The actual format of the service request and response will be
  574.        determined by the resolution protocol, and is the subject for other
  575.        documents (e.g. [4]). Protocols need not offer all services. The labels
  576.        for service requests shall be formed from the set of
  577.        characters [A-Z0-9]. The case of the alphabetic characters is
  578.        not significant.
  579.  
  580. Regexp
  581.        A STRING containing a substitution expression that is applied to the
  582.        original URI in order to construct the next name to lookup. The grammar
  583.        of the substitution expression is given in the next section.
  584.  
  585. Replacement
  586.        The next NAME to query for NAPTR, SRV, or A records depending on
  587.        the value of the flags field. As mentioned above, this may be
  588.        compressed.
  589.  
  590.  
  591.  
  592. Substitution Expression Grammar:
  593. ================================
  594.  
  595. The content of the regexp field is a substitution expression. True sed(1)
  596. substitution expressions are not appropriate for use in this application for a
  597. variety of reasons, therefore the contents of the regexp field MUST follow the
  598. grammar below:
  599.  
  600.   subst_expr   = delim-char  ere  delim-char  repl  delim-char  *flags
  601.   delim-char   = "/" / "!" / ... (Any non-digit or non-flag character other
  602.                  than backslash '\'. All occurances of a delim_char in a
  603.                  subst_expr must be the same character.)
  604.   ere          = POSIX Extended Regular Expression (see [11], section 2.8.4)
  605.   repl         = dns_str /  backref / repl dns_str  / repl backref
  606.   dns_str      = ...... which RFC can I cite for this? 1035 seems obsolete .....
  607.   backref      = "\" 1POS_DIGIT
  608.   flags        = "i" 
  609.   DNS_CHAR     = "_" / "0" / "1" / ... / "9" / "a" / ... / "z"
  610.   POS_DIGIT    = "1" / "2" / ... / "9"  ; 0 is not an allowed backref value
  611.  
  612. The result of applying the substitution expression to the original URI shall
  613. be a legal domain name. Since it is possible for the regexp field to be
  614. improperly specified, such that a non-conforming domain name can be
  615. constructed, client software SHOULD verify that the result is a legal
  616. domain name before making queries on it. 
  617.  
  618. Backref expressions in the repl portion of the substitution expression
  619. are replaced by the (possibly empty) string of characters enclosed by '('
  620. and ')' in the ERE portion of the substitution expression. N is a single
  621. digit from 1 through 9, inclusive. It specifies the N'th backref expression,
  622. the one that begins with the N'th '(' and continues to the matching ')'.
  623. For example, the ERE
  624.                    (A(B(C)DE)(F)G)
  625. has backref expressions:
  626.                     \1  = ABCDEFG
  627.                     \2  = BCDE
  628.                     \3  = C
  629.                     \4  = F
  630.                 \5..\9  = error - no matching subexpression
  631.                  
  632. The "i" flag indicates that the ERE matching SHALL be performed in a
  633. case-insensitive fashion. Furthermore, any backref replacements MAY be
  634. normalized to lower case when the "i" flag is given.
  635.  
  636. The first character in the substitution expression shall be used as the
  637. character that delimits the components of the substitution expression.
  638. There must be exactly three non-escaped occurrences of the delimiter
  639. character in a substitution expression. Since escaped occurrences of
  640. the delimiter character will be interpreted as occurrences of that
  641. character, digits MUST NOT be used as delimiters. Backrefs would be
  642. confused with literal digits were this allowed. Similarly, if flags are
  643. specified in the substitution expression, the delimiter character must not
  644. also be a flag character. 
  645.  
  646.  
  647. Advice to domain administrators:
  648. ================================
  649.  
  650. Beware of regular expressions. Not only are they a pain to get
  651. correct on their own, but there is the previously mentioned interaction
  652. with DNS. Any backslashes in a regexp must be entered twice in a zone
  653. file in order to appear once in a query response. More seriously, the
  654. need for double backslashes has probably not been tested by all
  655. implementors of DNS servers. We anticipate that urn.net will be the
  656. heaviest user of regexps. Only when delegating portions of namespaces
  657. should the typical domain administrator need to use regexps.
  658.  
  659. On a related note, beware of interactions with the shell when manipulating
  660. regexps from the command line. Since '\' is a common escape character in
  661. shells, there is a good chance that when you think you are saying "\\" you
  662. are actually saying "\".  Similar caveats apply to characters such as
  663. '*', '(', etc.
  664.  
  665. The "a" flag allows the next lookup to be for A records rather than
  666. SRV records. Since there is no place for a port specification in the
  667. NAPTR record, when the "A" flag is used the specified protocol must
  668. be running on its default port. 
  669.  
  670. The URN-WG is discussing the use of international characters in URNs.
  671. Regular expressions for strings in international character sets are likely
  672. to be essentially impossible to read or write by hand.
  673.  
  674.  
  675. Usage
  676. =====
  677.  
  678. For the edification of implementers, pseudocode for a client routine using NAPTRs is given below. This code is provided merely as a convience, it does
  679. not have any weight as a standard way to process NAPTR records. Also, as is
  680. the case with pseudocode, it has never been executed and may contain logical
  681. errors. You have been warned.
  682.  
  683.     //
  684.     // findResolver(URN)
  685.     // Given a URN, find a host that can resolve it.
  686.     // 
  687.     findResolver(string URN) {
  688.       sprintf(key, "%s.urn.net", extractNS(URN));  // prepend prefix to urn.net
  689.       do {
  690.         rewrite_flag = false;
  691.         terminal = false;
  692.     if (key has been seen) {
  693.       quit with a loop detected error
  694.     }
  695.     add key to list of "seens"
  696.     records = lookup(type=NAPTR, key); // get all NAPTR RRs for 'key'
  697.  
  698.         sort NAPTR records by "order" field and "preference" field
  699.             (with "order" being more significant than "preference").
  700.         n_naptrs = number of NAPTR records in response.
  701.         curr_order = records[0].order;
  702.         max_order = records[n_naptrs-1].order;
  703.         
  704.         // Process current batch of NAPTRs according to "order" field.
  705.         for (j=0; j < n_naptrs && records[j].order <= max_order; j++) {
  706.           if (unknown-flag) // skip this record and go to next one
  707.              continue; 
  708.           newkey = rewrite(URN, naptr[j].replacement, naptr[j].regexp);
  709.           if (!newkey) // Skip to next record if the rewrite didn't match
  710.              continue;  
  711.           // We did do a rewrite, shrink max_order to current value
  712.           // so that delegation works properly
  713.           max_order = naptr[j].order;
  714.           // Will we know what to do with the protocol and services
  715.           // specified in the NAPTR? If not, try next record.
  716.           if(!isKnownProto(naptr[j].services)) {
  717.             continue;
  718.           }
  719.           if(!isKnownService(naptr[j].services)) {
  720.             continue;
  721.           }
  722.  
  723.           // At this point we have a successful rewrite and we will know
  724.           // how to speak the protocol and request a known resolution
  725.           // service. Before we do the next lookup, check some
  726.           // optimization possibilities.
  727.           
  728.           if (strcasecmp(flags, "S")
  729.            || strcasecmp(flags, "P"))
  730.            || strcasecmp(flags, "A")) {
  731.              terminal = true;
  732.              services = naptr[j].services;
  733.              addnl = any SRV and/or A records returned as additional info
  734.                      for naptr[j].
  735.           }
  736.           key = newkey;
  737.           rewriteflag = true;
  738.           break;
  739.         }
  740.       } while (rewriteflag && !terminal);
  741.  
  742.       // Did we not find our way to a resolver?
  743.       if (!rewrite_flag) {
  744.          report an error
  745.          return NULL;
  746.       }
  747.  
  748.  
  749.       // Leave rest to another protocol?
  750.       if (strcasecmp(flags, "P")) {
  751.          return key as host to talk to;
  752.       }
  753.  
  754.       // If not, keep plugging
  755.       if (!addnl) { // No SRVs came in as additional info, look them up
  756.         srvs = lookup(type=SRV, key);
  757.       }  
  758.  
  759.       sort SRV records by preference, weight, ...
  760.       foreach (SRV record) { // in order of preference
  761.         try contacting srv[j].target using the protocol and one of the
  762.             resolution service requests from the "services" field of the
  763.             last NAPTR record.
  764.         if (successful)
  765.           return (target, protocol, service);
  766.           // Actually we would probably return a result, but this
  767.           // code was supposed to just tell us a good host to talk to.
  768.       }
  769.       die with an "unable to find a host" error;
  770.     }
  771.  
  772.  
  773. Notes:
  774. ======
  775.   -  A client MUST process multiple NAPTR records in the order specified by
  776.      the "order" field, it MUST NOT simply use the first record that provides
  777.      a known protocol and service combination.
  778.   -  If a record at a particular order matches the URI, but the client
  779.      doesn't know the specified protocol and service, the client SHOULD
  780.      continue to examine records that have the same order. The client
  781.      MUST NOT consider records with a higher value of order. This is
  782.      necessary to make delegation of portions of the namespace work.
  783.      The order field is what lets site administrators say "all requests for
  784.      URIs matching pattern x go to server 1, all others go to server 2".
  785.      (A match is defined as:
  786. 1)  The NAPTR provides a replacement domain name
  787.         or
  788.         2) The regular expression matches the URN
  789.      )
  790.   -  When multiple RRs have the same "order", the client should use
  791.      the value of the preference field to select the next NAPTR to
  792.      consider. However, because of preferred protocols or services,
  793.      estimates of network distance and bandwidth, etc. clients
  794.      may use different criteria to sort the records.
  795.   -  If the lookup after a rewrite fails, clients are strongly encouraged
  796.      to report a failure, rather than backing up to pursue other rewrite
  797.      paths.
  798.   -  When a namespace is to be delegated among a set of resolvers, regexps
  799.      must be used. Each regexp appears in a separate NAPTR RR. Administrators
  800.      should do as little delegation as possible, because of limitations on
  801.      the size of DNS responses.
  802.   -  Note that SRV RRs impose additional requirements on clients.
  803.  
  804.  
  805. Acknowledgments:
  806. =================
  807.  
  808. The authors would like to thank Keith Moore for all his consultations
  809. during the development of this draft. We would also like to thank Paul
  810. Vixie for his assistance in debugging our implementation, and his answers
  811. on our questions.
  812.  
  813.  
  814. References:
  815. ===========
  816.  
  817. [1] RFC-1737, "Functional Requirements for Uniform Resource Names", Karen
  818.     Sollins and Larry Masinter, Dec. 1994.
  819.  
  820. [2] Urn implementors article in DLIB?
  821. Perhaps
  822. [2] draft-daigle-urn-framework-00.txt "A Uniform Resource Naming
  823.     Framework", Leslie Daigle and Patrik Faltstrom, June, 1996.
  824.  
  825.  
  826. [3] RFC 2052, "A DNS RR for specifying the location of services (DNS SRV)",
  827.     A. Gulbrandsen and P. Vixie, October 1996.
  828.  
  829. [4] RFC-xxxx, "Conventions for the Use of HTTP for Resolution of URNs",
  830.     Ron Daniel Jr., currently available as draft-ietf-urn-http-conv-01.txt,
  831.     Dec. 1996.
  832.  
  833. [5] RFC-xxxx, "URN Resolution Services", ???, draft-ietf-urn-???
  834.     (This document is on the URN-WG's list of documents to prepare, but
  835.     has not yet been written. It will get its start from the treatment of
  836.     resolution services in [4]).
  837.  
  838. [6] Keith Moore, "Resource Cataloging and Distribution Service", ???
  839.  
  840. [7] Paul Vixie, personal communication.
  841.  
  842. [8] RFC-822, "Standard for the Format of ARPA Internet Text Messages",
  843.     Dave H. Crocker, August 1982.  
  844.  
  845. [9] Charles Orth, Bill Arms; Handle Resolution Protocol Specification,
  846.     http://www.handle.net/docs/client_spec.html
  847.  
  848. [10] RFC-1714, "Referral Whois Protocol (RWhois)", S. Williamson and
  849.      M. Kosters, November 1994.
  850.  
  851. [11] IEEE Standard for Information Technology - Portable Operating System
  852.     Interface (POSIX) - Part 2: Shell and Utilities (Vol. 1); IEEE Std
  853.     1003.2-1992; The Institute of Electrical and Electronics Engineers;
  854.     New York; 1993. ISBN:1-55937-255-9
  855.  
  856.  
  857.  
  858.  
  859. Security Considerations
  860. =======================
  861.   The use of "urn.net" as the registry for URN namespaces is subject to
  862.   denial of service attacks, as well as other DNS spoofing attacks. The
  863.   interactions with DNSSEC are currently being studied. It is expected
  864.   that NAPTR records will be signed with SIG records once the DNSSEC
  865.   work is deployed. 
  866.  
  867.   The rewrite rules make identifiers from other namespaces subject to
  868.   the same attacks as normal domain names. Since they have not been
  869.   easily resolvable before, this may or may not be considered a problem.
  870.  
  871.   Regular expressions should be checked for sanity, not blindly passed
  872.   to something like PERL. 
  873.  
  874. Author Contact Information:
  875. ===========================
  876.  
  877. Ron Daniel
  878. Los Alamos National Laboratory
  879. MS B287
  880. Los Alamos, NM, USA, 87545
  881. voice:  +1 505 665 0597
  882. fax:    +1 505 665 4939
  883. email:  rdaniel@lanl.gov
  884.  
  885.  
  886. Michael Mealling
  887. Network Solutions
  888. 505 Huntmar Park Drive
  889. Herndon, VA  22070
  890. voice: (703) 742-0400
  891. fax: (703) 742-9552
  892. email: michaelm@internic.net
  893. URL: http://www.netsol.com/
  894.  
  895.  
  896.  
  897.  
  898.     This draft expires 14 July, 1997.
  899.  
  900. Ron Daniel Jr.                   email: rdaniel@acl.lanl.gov
  901. Advanced Computing Lab, MS B287  voice: (505) 665-0597
  902. Los Alamos National Laboratory     fax: (505) 665-4939
  903. Los Alamos, NM, USA 87545         http://www.acl.lanl.gov/~rdaniel/
  904. Want to buy: "The Five Laws of Library Science" by S.R. Ranganathan